package com.swdegao.iot.netty.server.silianhandler;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.timeout.IdleStateHandler;

import java.util.concurrent.TimeUnit;
public class SiLian_NettyServerChannelInitializer extends ChannelInitializer<SocketChannel> {
//	 private EventLoopGroup pusheventloop  = new NioEventLoopGroup();

    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {


    	socketChannel.pipeline().addLast(new IdleStateHandler(120,0,0, TimeUnit.SECONDS));
    	socketChannel.pipeline().addLast(new SiLian_DATADecoder(1<<20,1,2,-3,0));
    	socketChannel.pipeline().addLast(new SiLian_HeartBeatClientHandler());
    	socketChannel.pipeline().addLast(new SiLian_ParseMessgaeHandler());
    	socketChannel.pipeline().addLast(new SiLian_SaveMessgaeHandler());
    	socketChannel.pipeline().addLast(new SiLian_PushMessgaeHandler());
    }
}
